package org.mspring.mlog.entity.bbs;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 版块分类
 * 
 * @author Gao Youbo
 * @since 2013年8月6日
 */
@Entity
@Table(name = "forum_catalog")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class ForumCatalog implements Serializable {

    private static final long serialVersionUID = 5432902848345781470L;

    private Long id;
    private String name;
    private Integer order;

    private List<Forum> forums;

    private Long topics; // 主题数
    private Long replys; // 回帖数

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "name", length = 30, nullable = false)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(name = "order")
    public Integer getOrder() {
        return order;
    }

    public void setOrder(Integer order) {
        this.order = order;
    }

    @OneToMany(fetch = FetchType.LAZY)
    public List<Forum> getForums() {
        return forums;
    }

    public void setForums(List<Forum> forums) {
        this.forums = forums;
    }

    @Column(name = "topics")
    public Long getTopics() {
        return topics;
    }

    public void setTopics(Long topics) {
        this.topics = topics;
    }

    @Column(name = "replys")
    public Long getReplys() {
        return replys;
    }

    public void setReplys(Long replys) {
        this.replys = replys;
    }
}
